/**
 * @Description: 提供月信息查询接口
 * @author Fengli
 * @date 5/31/19
*/
import global from '@/util/const/global'
import {queryDayTasksCount} from '@/util/dao/TaskStoreDao'

/**
 *  获取某月每一天的总任务量
 * @param month
 * @returns {Array}
 */
export async function getMonthTaskInfo (month) {
  let data = []
  let temp = new Date(month.getFullYear(), month.getMonth(), month.getDate())
  while (temp.getMonth() === month.getMonth()) {
    let row = []
    row.push(temp.getDate())
    // 获取当前天所有的任务量
    await queryDayTasksCount(temp.format(global.formatDate2)).then((response) => {
      row.push(response)
      data.push(row)
    })
    temp.setDate(temp.getDate() + 1)
  }
  return data
}
